#include<string.h>
#include<ctype.h>
#include<stdio.h>
int isvowel(int c)
{
	char s = tolower(c);
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u')
		return 1;
	else
		return 0;
}

char* reverseVowels(char* s)
{
	int left = -1;
	int right = strlen(s);
	while (++left < --right)
	{
		while (!isvowel(s[left]) && left < right)
			left++;
		while (!isvowel(s[right]) && left < right)
			right--;
		if (left < right)
		{
			char tmp = s[left];
			s[left] = s[right];
			s[right] = tmp;
		}
	}
	return s;
}

int maxArea(int* height, int heightSize)
{
	int left = 0;
	int right = heightSize - 1;
	int area = (height[left] > height[right] ? height[right] : height[left]) * (right - left);
	while (left < right)
	{
		if (height[left] > height[right])
			--right;
		else
			++left;
		if ((height[left] > height[right] ? height[right] : height[left]) * (right - left) > area)
		{
			area = (height[left] > height[right] ? height[right] : height[left]) * (right - left);
		}
	}
	return area;
}

int minSubArrayLen(int target, int* nums, int numsSize)
{
	int left = 0;
	int right = 0;
	int sum = nums[0];
	int num = numsSize + 1;
	while (right < numsSize)
	{
		if (sum >= target)
		{
			if (left == right)
				return 1;
			else
			{
				num = (right - left + 1 < num ? right - left + 1 : num);
				sum -= nums[left++];
			}
		}
		else if (++right < numsSize)
			sum += nums[right];
	}
	if (num == numsSize + 1)
		return 0;
	return num;
}

int main()
{
	int arr[9] = { 1,8,6,2,5,4,8,3,7 };
	int max = maxArea(arr, 9);
	return;
}